home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / SASC_6.0_Disk_4.adf / Compiler_Headers / Include / dos / dos.h < prev    next >
C/C++ Source or Header  |  1992-07-30  |  9KB  |  251 lines

  1. #ifndef DOS_DOS_H
  2. #define DOS_DOS_H
  3. /*
  4. **    $Filename: dos/dos.h $
  5. **    $Release: 2.04 Includes, V37.4 $
  6. **    $Revision: 36.24 $
  7. **    $Date: 91/10/29 $
  8. **
  9. **    Standard C header for AmigaDOS
  10. **
  11. **    (C) Copyright 1985-1991 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include "exec/types.h"
  17. #endif
  18.  
  19.  
  20. #define     DOSNAME  "dos.library"
  21.  
  22. /* Predefined Amiga DOS global constants */
  23.  
  24. #define DOSTRUE (-1L)
  25. #define DOSFALSE (0L)
  26.  
  27. /* Mode parameter to Open() */
  28. #define MODE_OLDFILE         1005   /* Open existing file read/write
  29.                      * positioned at beginning of file. */
  30. #define MODE_NEWFILE         1006   /* Open freshly created file (delete
  31.                      * old file) read/write, exclusive lock. */
  32. #define MODE_READWRITE         1004   /* Open old file w/shared lock,
  33.                      * creates file if doesn't exist. */
  34.  
  35. /* Relative position to Seek() */
  36. #define OFFSET_BEGINNING    -1        /* relative to Begining Of File */
  37. #define OFFSET_CURRENT         0        /* relative to Current file position */
  38. #define OFFSET_END         1        /* relative to End Of File      */
  39.  
  40. #define OFFSET_BEGINING        OFFSET_BEGINNING  /* ancient compatibility */
  41.  
  42. #define BITSPERBYTE         8
  43. #define BYTESPERLONG         4
  44. #define BITSPERLONG         32
  45. #define MAXINT             0x7FFFFFFF
  46. #define MININT             0x80000000
  47.  
  48. /* Passed as type to Lock() */
  49. #define SHARED_LOCK         -2        /* File is readable by others */
  50. #define ACCESS_READ         -2        /* Synonym */
  51. #define EXCLUSIVE_LOCK         -1        /* No other access allowed      */
  52. #define ACCESS_WRITE         -1        /* Synonym */
  53.  
  54. struct DateStamp {
  55.    LONG     ds_Days;          /* Number of days since Jan. 1, 1978 */
  56.    LONG     ds_Minute;          /* Number of minutes past midnight */
  57.    LONG     ds_Tick;          /* Number of ticks past minute */
  58. }; /* DateStamp */
  59.  
  60. #define TICKS_PER_SECOND      50   /* Number of ticks in one second */
  61.  
  62. /* Returned by Examine() and ExNext(), must be on a 4 byte boundary */
  63. struct FileInfoBlock {
  64.    LONG      fib_DiskKey;
  65.    LONG      fib_DirEntryType;  /* Type of Directory. If < 0, then a plain file.
  66.                   * If > 0 a directory */
  67.    char      fib_FileName[108]; /* Null terminated. Max 30 chars used for now */
  68.    LONG      fib_Protection;    /* bit mask of protection, rwxd are 3-0.       */
  69.    LONG      fib_EntryType;
  70.    LONG      fib_Size;         /* Number of bytes in file */
  71.    LONG      fib_NumBlocks;     /* Number of blocks in file */
  72.    struct DateStamp fib_Date;/* Date file last changed */
  73.    char      fib_Comment[80];  /* Null terminated comment associated with file */
  74.    char      fib_Reserved[36];
  75. }; /* FileInfoBlock */
  76.  
  77. /* FIB stands for FileInfoBlock */
  78.  
  79. /* FIBB are bit definitions, FIBF are field definitions */
  80. #define FIBB_SCRIPT    6    /* program is a script (execute) file */
  81. #define FIBB_PURE      5    /* program is reentrant and rexecutable */
  82. #define FIBB_ARCHIVE   4    /* cleared whenever file is changed */
  83. #define FIBB_READ      3    /* ignored by old filesystem */
  84. #define FIBB_WRITE     2    /* ignored by old filesystem */
  85. #define FIBB_EXECUTE   1    /* ignored by system, used by Shell */
  86. #define FIBB_DELETE    0    /* prevent file from being deleted */
  87. #define FIBF_SCRIPT    (1<<FIBB_SCRIPT)
  88. #define FIBF_PURE      (1<<FIBB_PURE)
  89. #define FIBF_ARCHIVE   (1<<FIBB_ARCHIVE)
  90. #define FIBF_READ      (1<<FIBB_READ)
  91. #define FIBF_WRITE     (1<<FIBB_WRITE)
  92. #define FIBF_EXECUTE   (1<<FIBB_EXECUTE)
  93. #define FIBF_DELETE    (1<<FIBB_DELETE)
  94.  
  95. /* Standard maximum length for an error string from fault.  However, most */
  96. /* error strings should be kept under 60 characters if possible.  Don't   */
  97. /* forget space for the header you pass in. */
  98. #define FAULT_MAX    82
  99.  
  100. /* All BCPL data must be long word aligned.  BCPL pointers are the long word
  101.  *  address (i.e byte address divided by 4 (>>2)) */
  102. typedef long  BPTR;            /* Long word pointer */
  103. typedef long  BSTR;            /* Long word pointer to BCPL string     */
  104.  
  105. /* Convert BPTR to typical C pointer */
  106. #ifdef OBSOLETE_LIBRARIES_DOS_H
  107. #define BADDR( bptr )    (((ULONG)bptr) << 2)
  108. #else
  109. /* This one has no problems with CASTing */
  110. #define BADDR(x)    ((APTR)((ULONG)(x) << 2))
  111. #endif
  112. /* Convert address into a BPTR */
  113. #define MKBADDR(x)    (((LONG)(x)) >> 2)
  114.  
  115. /* BCPL strings have a length in the first byte and then the characters.
  116.  * For example:     s[0]=3 s[1]=S s[2]=Y s[3]=S                 */
  117.  
  118. /* returned by Info(), must be on a 4 byte boundary */
  119. struct InfoData {
  120.    LONG      id_NumSoftErrors;    /* number of soft errors on disk */
  121.    LONG      id_UnitNumber;    /* Which unit disk is (was) mounted on */
  122.    LONG      id_DiskState;        /* See defines below */
  123.    LONG      id_NumBlocks;        /* Number of blocks on disk */
  124.    LONG      id_NumBlocksUsed;    /* Number of block in use */
  125.    LONG      id_BytesPerBlock;
  126.    LONG      id_DiskType;        /* Disk Type code */
  127.    BPTR      id_VolumeNode;    /* BCPL pointer to volume node */
  128.    LONG      id_InUse;        /* Flag, zero if not in use */
  129. }; /* InfoData */
  130.  
  131. /* ID stands for InfoData */
  132.     /* Disk states */
  133. #define ID_WRITE_PROTECTED 80     /* Disk is write protected */
  134. #define ID_VALIDATING       81     /* Disk is currently being validated */
  135. #define ID_VALIDATED       82     /* Disk is consistent and writeable */
  136.  
  137.     /* Disk types */
  138. /* ID_INTER_* use international case comparison routines for hashing */
  139. #define ID_NO_DISK_PRESENT    (-1)
  140. #define ID_UNREADABLE_DISK    (0x42414400L)    /* 'BAD\0' */
  141. #define ID_DOS_DISK        (0x444F5300L)    /* 'DOS\0' */
  142. #define ID_FFS_DISK        (0x444F5301L)    /* 'DOS\1' */
  143. #define ID_INTER_DOS_DISK    (0x444F5302L)    /* 'DOS\2' */
  144. #define ID_INTER_FFS_DISK    (0x444F5303L)    /* 'DOS\3' */
  145. #define ID_NOT_REALLY_DOS    (0x4E444F53L)    /* 'NDOS'  */
  146. #define ID_KICKSTART_DISK    (0x4B49434BL)    /* 'KICK'  */
  147. #define ID_MSDOS_DISK        (0x4d534400L)    /* 'MSD\0' */
  148.  
  149. /* Errors from IoErr(), etc. */
  150. #define ERROR_NO_FREE_STORE          103
  151. #define ERROR_TASK_TABLE_FULL          105
  152. #define ERROR_BAD_TEMPLATE          114
  153. #define ERROR_BAD_NUMBER          115
  154. #define ERROR_REQUIRED_ARG_MISSING      116
  155. #define ERROR_KEY_NEEDS_ARG          117
  156. #define ERROR_TOO_MANY_ARGS          118
  157. #define ERROR_UNMATCHED_QUOTES          119
  158. #define ERROR_LINE_TOO_LONG          120
  159. #define ERROR_FILE_NOT_OBJECT          121
  160. #define ERROR_INVALID_RESIDENT_LIBRARY      122
  161. #define ERROR_NO_DEFAULT_DIR          201
  162. #define ERROR_OBJECT_IN_USE          202
  163. #define ERROR_OBJECT_EXISTS          203
  164. #define ERROR_DIR_NOT_FOUND          204
  165. #define ERROR_OBJECT_NOT_FOUND          205
  166. #define ERROR_BAD_STREAM_NAME          206
  167. #define ERROR_OBJECT_TOO_LARGE          207
  168. #define ERROR_ACTION_NOT_KNOWN          209
  169. #define ERROR_INVALID_COMPONENT_NAME      210
  170. #define ERROR_INVALID_LOCK          211
  171. #define ERROR_OBJECT_WRONG_TYPE          212
  172. #define ERROR_DISK_NOT_VALIDATED      213
  173. #define ERROR_DISK_WRITE_PROTECTED      214
  174. #define ERROR_RENAME_ACROSS_DEVICES      215
  175. #define ERROR_DIRECTORY_NOT_EMPTY      216
  176. #define ERROR_TOO_MANY_LEVELS          217
  177. #define ERROR_DEVICE_NOT_MOUNTED      218
  178. #define ERROR_SEEK_ERROR          219
  179. #define ERROR_COMMENT_TOO_BIG          220
  180. #define ERROR_DISK_FULL              221
  181. #define ERROR_DELETE_PROTECTED          222
  182. #define ERROR_WRITE_PROTECTED          223
  183. #define ERROR_READ_PROTECTED          224
  184. #define ERROR_NOT_A_DOS_DISK          225
  185. #define ERROR_NO_DISK              226
  186. #define ERROR_NO_MORE_ENTRIES          232
  187. /* added for 1.4 */
  188. #define ERROR_IS_SOFT_LINK          233
  189. #define ERROR_OBJECT_LINKED          234
  190. #define ERROR_BAD_HUNK              235
  191. #define ERROR_NOT_IMPLEMENTED          236
  192. #define ERROR_RECORD_NOT_LOCKED          240
  193. #define ERROR_LOCK_COLLISION          241
  194. #define ERROR_LOCK_TIMEOUT          242
  195. #define ERROR_UNLOCK_ERROR          243
  196.  
  197. /* error codes 303-305 are defined in dosasl.h */
  198.  
  199. /* These are the return codes used by convention by AmigaDOS commands */
  200. /* See FAILAT and IF for relvance to EXECUTE files              */
  201. #define RETURN_OK                0  /* No problems, success */
  202. #define RETURN_WARN                5  /* A warning only */
  203. #define RETURN_ERROR               10  /* Something wrong */
  204. #define RETURN_FAIL               20  /* Complete or severe failure*/
  205.  
  206. /* Bit numbers that signal you that a user has issued a break */
  207. #define SIGBREAKB_CTRL_C   12
  208. #define SIGBREAKB_CTRL_D   13
  209. #define SIGBREAKB_CTRL_E   14
  210. #define SIGBREAKB_CTRL_F   15
  211.  
  212. /* Bit fields that signal you that a user has issued a break */
  213. /* for example:     if (SetSignal(0,0) & SIGBREAKF_CTRL_C) cleanup_and_exit(); */
  214. #define SIGBREAKF_CTRL_C   (1<<SIGBREAKB_CTRL_C)
  215. #define SIGBREAKF_CTRL_D   (1<<SIGBREAKB_CTRL_D)
  216. #define SIGBREAKF_CTRL_E   (1<<SIGBREAKB_CTRL_E)
  217. #define SIGBREAKF_CTRL_F   ((long)1<<SIGBREAKB_CTRL_F)
  218.  
  219. /* Values returned by SameLock() */
  220. #define LOCK_DIFFERENT        -1
  221. #define LOCK_SAME        0
  222. #define LOCK_SAME_VOLUME    1    /* locks are on same volume */
  223. #define LOCK_SAME_HANDLER    LOCK_SAME_VOLUME
  224. /* LOCK_SAME_HANDLER was a misleading name, def kept for src compatibility */
  225.  
  226. /* types for ChangeMode() */
  227. #define CHANGE_LOCK    0
  228. #define CHANGE_FH    1
  229.  
  230. /* Values for MakeLink() */
  231. #define LINK_HARD    0
  232. #define LINK_SOFT    1    /* softlinks are not fully supported yet */
  233.  
  234. /* values returned by ReadItem */
  235. #define    ITEM_EQUAL    -2        /* "=" Symbol */
  236. #define ITEM_ERROR    -1        /* error */
  237. #define ITEM_NOTHING    0        /* *N, ;, endstreamch */
  238. #define ITEM_UNQUOTED    1        /* unquoted item */
  239. #define ITEM_QUOTED    2        /* quoted item */
  240.  
  241. /* types for AllocDosObject/FreeDosObject */
  242. #define DOS_FILEHANDLE        0    /* few people should use this */
  243. #define DOS_EXALLCONTROL    1    /* Must be used to allocate this! */
  244. #define    DOS_FIB            2    /* useful */
  245. #define DOS_STDPKT        3    /* for doing packet-level I/O */
  246. #define DOS_CLI            4    /* for shell-writers, etc */
  247. #define DOS_RDARGS        5    /* for ReadArgs if you pass it in */
  248.  
  249. #endif    /* DOS_DOS_H */
  250.  
  251.